﻿@page "/listgroup"

@using BootstrapBlazorApp.OnlyServer.Data

<ListGroup TItem="Foo" Items="@Items" @bind-Value="Value" HeaderText="船名/航次" GetItemDisplayText="GetItemDisplayText">
</ListGroup>

@Value?.Name
 
@code {
    public List<Foo>? Items{ get; set; }

    public Foo? Value{ get; set; }

    protected override void OnInitialized()
    {
        Items = new List<Foo>();
        Items.Add(new Foo() {  Name="A",Address="class A"});
        Items.Add(new Foo() { Name = "B", Address = "class B" });
        Items.Add(new Foo() { Name = "C", Address = "class C" });
    }

    string GetItemDisplayText(Foo item)
    {
        return $"{item.Name}/{item.Address}";
    }
}
